define(function(require, exports, module) {

  var Backbone = require('backbone');
  var $ = require('jquery');
  var _ = require('underscore');
  var jsonview = require('jsonview');
  var tmpl = require('text!../tmpl.html');

  var echarts = require('js/echarts');

  function main() {
    var $app = $('<div id="app">');
    $('#main').html($app);

    $app.append(tmpl);
    var chart = echarts.init($('#canvas-test')[0]);

    $('#test').click(function() {
      var jsonAsStr = $('#option-json').val()
      var option = JSON.parse(jsonAsStr)
      chart.clear()
      chart.setOption(option, true)
    })
  }

  return main;
})
